﻿using System.Windows;
using System.Windows.Input;
using JDKD.BMCS.Business;
using NutShell.DesignPattern;

namespace JDKD.BMCS.AppUI
{
        /// <summary>
        /// LoginWindow.xaml 的交互逻辑
        /// </summary>
        public partial class PasswordWindow : Window
        {
                

                public PasswordWindow()
                {
                        InitializeComponent();
                }

                #region 字段

                private BusinessCache cache = Singleton<BusinessCache>.Instance;

                #endregion 字段

                private void Window_Loaded(object sender, RoutedEventArgs e)
                {
                        PasswordTextBox.Focus();
                }

                private void Window_MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
                {
                        if (e.ChangedButton == MouseButton.Left)
                        {
                                this.DragMove();
                        }
                }

                

                private void ClearButton_Click(object sender, RoutedEventArgs e)
                {
                        PasswordTextBox.Password = string.Empty;
                }

                private void OneButton_Click(object sender, RoutedEventArgs e)
                {
                        PasswordTextBox.Password += 1;
                }

                private void TwoButton_Click(object sender, RoutedEventArgs e)
                {
                        PasswordTextBox.Password += 2;
                }

                private void ThreeButton_Click(object sender, RoutedEventArgs e)
                {
                        PasswordTextBox.Password += 3;
                }

                private void FourButton_Click(object sender, RoutedEventArgs e)
                {
                        PasswordTextBox.Password += 4;
                }

                private void FiveButton_Click(object sender, RoutedEventArgs e)
                {
                        PasswordTextBox.Password += 5;
                }

                private void SixButton_Click(object sender, RoutedEventArgs e)
                {
                        PasswordTextBox.Password += 6;
                }

                private void SevenButton_Click(object sender, RoutedEventArgs e)
                {
                        PasswordTextBox.Password += 7;
                }

                private void EightButton_Click(object sender, RoutedEventArgs e)
                {
                        PasswordTextBox.Password += 8;
                }

                private void NineButton_Click(object sender, RoutedEventArgs e)
                {
                        PasswordTextBox.Password += 9;
                }

                private void ZeroButton_Click(object sender, RoutedEventArgs e)
                {
                        PasswordTextBox.Password += 0;
                }

                private void AcceptButton_Click(object sender, RoutedEventArgs e)
                {
                        if (PasswordTextBox.Password != "123")
                        {
                                MessageBox.Show("密码错误");
                                return;
                        }

                        cache.IsLogined = true;

                        Close();
                }

                private void CancelButton_Click(object sender, RoutedEventArgs e)
                {
                        Close();
                }
        }
}